word的构建基块(Building Block)的创建与使用 您所在的位置:网站首页 building block是什么意思 word的构建基块(Building Block)的创建与使用

word的构建基块(Building Block)的创建与使用

2023-11-30 07:52| 来源: 网络整理| 查看: 265

构建基块类似与数据块,用于存储具有固定格式且经常被使用的文字、图形、表格或其他特定对象。构建基块保存在Word模板中,使用者可以将其插入到任何Word文档中的任意指定位置。下图是构建基块的主要操作入口:

 

关于构建基块的详细内容,参见官方文档:在 Word 文档中创建和使用内容构建基块

 

在程序中通过代码来插入构建基块的方式如下所示:

///在当前Selection位置插入指定名称为buildingBlockName的构建基块 public void InsertBuildingBlock(string buildingBlockName) { Template tp = (Template)((dynamic)this._wordDocument.get_AttachedTemplate()); object isRichText = (object)true; object bbIndex= (object)buildingBlockName; //myWordApplication是word应用程序接口对象,此处表示本方法所在类对象的字段,实际使用时也可以通过方法参数传入 tp.BuildingBlockEntries.Item(ref bbIndex).Insert(myWordApplication.Selection.Range, ref isRichText); }

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有